#include <iostream>

using namespace std;

int main() {
   int n; //长度为n的整数序列
    cin>>n;
   int a[n];
   int count=0; //定义出现连号的次数
   int max=0;

    for (int i = 0; i <n; i++) {
        cin>>a[i];
    }
    for (int i = 0; i < n - 1; i++) {
        if (a[i+1]-a[i]==1){
            count++;
            if (count>max){
                max=count;
            }
        } else{
            count=0;
        }

    }
cout<<max+1;
    return 0;
}
